?><?
function table_serialize($resource){
	$result=array();
	$result["fields"]=false;
	$result["values"]=array();
	while($row=mysql_fetch_assoc($resource)){
		if($result["fields"]===false){$result["fields"]=array_keys($row);}
		$result["values"][]=row_serialize(array_values($row));
	}
	return serialize($result);
}

function row_serialize($data){
	return $data;
}

function jr($data){json_response($data);}
function json_response($data){
	if(!is_array($data)){$data=array("status"=>$data);}
	echo json_encode((object)$data);
	die();
}

function table_unserialize($table,$data){
	$structure=unserialize($data);
	
	ExeqSQL($sql);
}